import request from '@/utils/request'

export function getList(tid, pageNum, pageSize) {
  return request({
    url: 'http://localhost:8080/product/list',
    method: 'get',
    params: {
      tid,
      pageNum,
      pageSize
    }
  })
}

export function getAllList(tid) {
  return request({
    url: 'http://localhost:8080/product/list/'+tid,
    method: 'get',
  })
}

export function getDetails(pid) {
  return request({
    url: 'http://localhost:8080/product/' + pid,
    method: 'get'
  })
}

export function insertProduct(product) {
  return request({
    url: 'http://localhost:8080/product/create',
    method: 'post',
    data:product
  })
}

export function deleteProduct(pid) {
  return request({
    url: 'http://localhost:8080/product/'+pid,
    method: 'delete'
  })
}
